package com.asa.ui.C;

import java.awt.Point;

import com.asa.ui.B.Circle;
import com.asa.ui.B.MonteCarloData;
/**
 * 求PI
 * @author asa
 *
 */
public class MonteCarloeExperiment {
	public MonteCarloeExperiment(int Number,int  RectangleWidth,int side){
		Circle circle=new Circle(RectangleWidth/2, RectangleWidth/2, RectangleWidth/2);
		MonteCarloData data=new MonteCarloData(circle);
		for(int i=0;i<Number;i++){
			if(i%side==0){
				System.out.println(data.questPI());
			}
			int x=(int)(Math.random()* RectangleWidth);
			int y=(int)(Math.random()* RectangleWidth);
			data.addPoint(new Point(x,y));
			data.countInsideCircle(i);
		}
	}
   public static void main(String[] args) {
	   new MonteCarloeExperiment(1000000,1000,10000);
   }

}
